from rest_framework import viewsets
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response

from index.server.server import Server


# Create your views here.
class IndexViewSet(viewsets.ModelViewSet):
    # 指定权限类， 要求用户认证
    permission_classes = [IsAuthenticated]

    # 注入服务
    server = Server()

    def get_hurun_rank_list(self, request):
        # 时间查询入参times，数据遵循国家数据时间筛选入参格式。
        datas = self.server.hurun_rank_datas()

        return Response(datas)

    def get_hot_rank_list(self, request):
        datas = self.server.hot_rank_datas()

        return Response(datas)
